<template>
    <div class="box1">
        <!-- 专利价值 -->
         <el-form-item label="专利价值" label-width="120px" style="width:94%">
            <div v-for="(item,index) in info" :key="index" class="sysItem">
              <el-select v-if="item.hasOwnProperty('notFrist')" v-model="item.boolType"  style="width:80px;margin-right:10px">
                    <el-option label="AND" value=1></el-option>
                    <el-option label="OR" value=2></el-option>
                    <el-option label="NOT" value=3></el-option>
            </el-select>
             <el-select v-if="!item.hasOwnProperty('notFrist')" v-model="item.key" placeholder="--请选择--" style="width:300px;margin-bottom:6px">
                    <el-option label="是否高价值专利" value="is_high_cost"></el-option>
                    <el-option label="高价值专利要素-战略性新兴产业" value="is_strategic_emerging"></el-option>
                    <el-option label="高价值专利要素—是否海外同族" value="has_abroad_family"></el-option>

                    <el-option label="高价值专利要素-发明维持超过10年" value="is_duration_ten_year"></el-option>
                    <el-option label="高价值专利要素-较高质押融资金额" value="is_high_inventory"></el-option>
                    <el-option label="高价值专利要素-获得国家科学技术奖或中国专利奖" value="has_reward"></el-option>

                    
            </el-select>

             <el-select v-if="item.hasOwnProperty('notFrist')" v-model="item.key" placeholder="--请选择--" style="width:210px;margin-bottom:6px">
                    <el-option label="是否高价值专利" value="is_high_cost"></el-option>
                    <el-option label="高价值专利要素-战略性新兴产业" value="is_strategic_emerging"></el-option>
                    <el-option label="高价值专利要素—是否海外同族" value="has_abroad_family"></el-option>

                    <el-option label="高价值专利要素-发明维持超过10年" value="is_duration_ten_year"></el-option>
                    <el-option label="高价值专利要素-较高质押融资金额" value="is_high_inventory"></el-option>
                    <el-option label="高价值专利要素-获得国家科学技术奖或中国专利奖" value="has_reward"></el-option>
                   
            </el-select>




             <el-select class="inputView" v-model="item.value" placeholder="--请选择--">
                     <el-option label="是" value="1"></el-option>
                    <el-option label="否" value="0"></el-option>
                   
            </el-select>
             <i @click="addPatentValue" style="position:absolute;right:-30px;fontSize:20px;marginTop:5px;color:#008ac0;font-weight:700" v-if="!item.hasOwnProperty('notFrist')" class="el-icon-circle-plus-outline"></i>
            <i @click="deltPatentValue(index)" style="position:absolute;right:-30px;fontSize:20px;marginTop:5px;color:#008ac0;font-weight:700" v-if="item.hasOwnProperty('notFrist')" class="el-icon-remove-outline"></i>
           </div>
           
        </el-form-item>
           
        
    </div>
</template>
<script>
export default {
    name:"patentValue",
    props:{
       
    },
    watch:{
        info:{
            handler(newV,OldV){
               
                this.$emit("done",this.translateForm(newV))

            },
            deep:true
        }

    },
    data(){
        return{
            result:[],
            info:[{
                value:'',
                key:"is_high_cost"
            }]
        }
    },
    methods:{
        translateForm(newV){
             let keys=["application_number","public_number","ipc_main","patent_type"]

             let tempArr=[]
             let list = JSON.parse(JSON.stringify(newV))
             list.forEach(item=>{
                 if(item.hasOwnProperty("key") ){
                     let obj ={
                         fieldName:item.key,
                         value:item.value,
                         boolType:item.hasOwnProperty("boolType")? item.boolType : 1
                     }
                     tempArr.push(obj)

                 }
             })

             return tempArr

        },

         addPatentValue(){
          if(this.info.length<4){
              let obj={
                  value:"",
                  notFrist:true,
                  boolType:"1"
              }
              this.info.push(obj)
          }
      },
      deltPatentValue(index){
        //  console.log(index)
         this.info.splice(index, 1);

      },
    }
}
</script>
<style lang="scss" scoped>
    
    .box1{
        width: 100%;
         background-color: #ffffff;
        // height:40px;
         ::v-deep .el-form-item__label{
            text-align: left;
            font-size: 12px;
            // color: red;
        }
        .sysItem{
            width: 100%;
            display: flex;
          flex-direction: row;
          .inputView{
              flex: 1;
              margin-left: 10px;
          }
        }
    }
</style>

